package com.yupi.usercenter.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * Classname: BaseResponse
 * Package: com.yupi.usercenter.common
 * Description:
 * 通用返回类
 * @Author Alex Liang
 * @Create 2024/8/18 下午4:43
 * @Version 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor

public class BaseResponse<T> implements Serializable {
    private int code;

    private T data;

    private String message;

    private String description;

    public BaseResponse(int code,T data, String description ) {
        this.data = data;
        this.code = code;
        this.message = "";
        this.description = "";
    }

    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(),null, errorCode.getMesssage(), errorCode.getDescription());
    }



}
